<html>
<head><meta charset="utf-8"><title>const propagation in generic functions · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/const.20propagation.20in.20generic.20functions.html">const propagation in generic functions</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="166270148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/const%20propagation%20in%20generic%20functions/near/166270148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/const.20propagation.20in.20generic.20functions.html#166270148">(May 22 2019 at 14:03)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> I remember something about generic functions not getting much out of the const propagator. We have loads of early aborts in the presence of generics: <a href="https://github.com/rust-lang/rust/blob/37ff5d388f8c004ca248adb635f1cc84d347eda0/src/librustc_mir/transform/const_prop.rs#L397" target="_blank" title="https://github.com/rust-lang/rust/blob/37ff5d388f8c004ca248adb635f1cc84d347eda0/src/librustc_mir/transform/const_prop.rs#L397">https://github.com/rust-lang/rust/blob/37ff5d388f8c004ca248adb635f1cc84d347eda0/src/librustc_mir/transform/const_prop.rs#L397</a></p>



<a name="166270243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/const%20propagation%20in%20generic%20functions/near/166270243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/const.20propagation.20in.20generic.20functions.html#166270243">(May 22 2019 at 14:04)</a>:</h4>
<p>After <a href="https://github.com/rust-lang/rust/pull/61041" target="_blank" title="https://github.com/rust-lang/rust/pull/61041">https://github.com/rust-lang/rust/pull/61041</a> we should be in a much better position to start looking into optimizing generic functions again</p>



<a name="166270271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/const%20propagation%20in%20generic%20functions/near/166270271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/const.20propagation.20in.20generic.20functions.html#166270271">(May 22 2019 at 14:04)</a>:</h4>
<p>Oh very cool!</p>



<a name="166270362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/const%20propagation%20in%20generic%20functions/near/166270362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/const.20propagation.20in.20generic.20functions.html#166270362">(May 22 2019 at 14:05)</a>:</h4>
<p>I'm working on trying to get the <code>Len</code> operand to const prop right now</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>